// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import Vue from 'vue'

const NAME = 'SecurePatrolReport'
if (!CORE.CACHE[NAME]) Vue.set(CORE.CACHE, NAME, {})

// ============================== 导出异步调用 ============================== //

export default {
  // —————————————————————————————— 信息 —————————————————————————————— //

  async remoteInfo({ state: { API, infoParam, MAP } }) {
    const CACHE = CORE.CACHE[MAP.CACHE]
    const ids = infoParam.ids.filter((id) => !CACHE[id])
    if (!ids.length) return

    const TIP = API.transTip('查询巡更点图片')
    const urlList = await API.getInfo({ ids }, TIP)
    urlList.forEach((url, i) => Vue.set(CACHE, ids[i], url))
  },
}
